<?xml version="1.0" encoding="UTF-8"?>
<!--
	- - - - - - - - - - - - - - - - - - - - - - - - - -
    FIXatdl Sample document instance for FIXatdl Schema Version 1.1
    (C) 2010 FIX Protocol Limited. All use of the FIXatdl Schema is subject to
    the disclaimer which is printed on one of the initial pages of the written specification
    for the FIXatdl Schema and is included in the zip file which you downloaded to
    obtain the Schema.
    Comments and errors should be posted on the FIX protocol web-site
    http://www.fixprotocol.org
	- - - - - - - - - - - - - - - - - - - - - - - - - -
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:lay="http://www.fixprotocol.org/FIXatdl-1-1/Validation" xmlns:core="http://www.fixprotocol.org/FIXatdl-1-1/Core" targetNamespace="http://www.fixprotocol.org/FIXatdl-1-1/Validation" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.1">
	<xs:annotation>
		<xs:documentation>
      This value is the internal build number of the ATDL Schema
    </xs:documentation>
		<xs:appinfo>
			<BuildInfo buildNumber="2.7.2e20101221"/>
		</xs:appinfo>
	</xs:annotation>
	<xs:import namespace="http://www.fixprotocol.org/FIXatdl-1-1/Core" schemaLocation="fixatdl-core-1-1.xsd"/>
	<!-- Please email any suggestions or revisions to algotech@fixprotocol.org-->
	<!-- Please note - Revision history is at the end of this xsd -->
	<!-- 
  
  Validation Sub-Schema
  In order to validate the parameter values entered by the user the following sub-schema has been provided. 
  It enables the creation of complex and conditional validation rules that can be applied to the algorithmic 
  orders generated by an OMS or EMS. -->
	<xs:element name="StrategyEdit" type="lay:StrategyEdit_t"/>
	<xs:complexType name="StrategyEdit_t">
		<xs:annotation>
			<xs:documentation>Specifies a strategy-wide rule consisting of a boolean expression and an error message to be didsplayed when the boolean expression evaluates to False().</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element ref="core:Description" minOccurs="0">
				<xs:annotation>
					<xs:documentation>Optional description of the Strategy Edit.</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:choice>
				<xs:element name="Edit" type="lay:Edit_t">
					<xs:annotation>
						<xs:documentation>Boolean expression evaluated in validation and flow control rules. An Edit element will describe a condition that is either true or false.</xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name="EditRef" type="lay:EditRef_t"/>
			</xs:choice>
		</xs:sequence>
		<xs:attribute name="errorMessage" type="xs:string" use="required">
			<xs:annotation>
				<xs:documentation>The error message to display when the boolean expression defined by StrategyEdit/Edit evaluates to False.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
	</xs:complexType>
	<xs:element name="Edit" type="lay:Edit_t"/>
	<xs:complexType name="Edit_t">
		<xs:annotation>
			<xs:documentation>Construct used to build a boolean expression.</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element ref="core:Description" minOccurs="0">
				<xs:annotation>
					<xs:documentation>Description of the Edit.</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="Edit" type="lay:Edit_t" minOccurs="0" maxOccurs="unbounded"/>
			<xs:element name="EditRef" type="lay:EditRef_t" minOccurs="0" maxOccurs="unbounded"/>
		</xs:sequence>
		<xs:attribute name="field" type="xs:string" use="optional">
			<xs:annotation>
				<xs:documentation>Field name for comparison. When the edit is used within a stateRule, this field must refer to the ID of a Control. When the edit is used within a strategyEdit, this field must refer to either the name of a parameter or a standard FIX field name. When referring to a standard FIX tag then the name must be pre-pended with the string “FIX_”, e.g. “FIX_OrderQty”.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="field2" type="xs:string" use="optional">
			<xs:annotation>
				<xs:documentation>Value used as the second operand. Used in conjunction with Edit/@field and Edit/@operator. Similar definition to Edit/@field except that it is mutually exclusive with Edit/@value.
Required when: Edit/@operator is in {GE, GT, LE, LT, EQ, NE} and Edit/@value is not specified.
</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="value" type="xs:string" use="optional">
			<xs:annotation>
				<xs:documentation>Value used as the second operand. Used in conjunction with Edit/@field and Edit/@operator. Represents a string literal value and not a reference.
When Edit is a descendant of a StateRule element, Edit/@value refers to the value of the control referred by Edit/@field. If the control referred by Edit/@field has enumerated values then Edit/@value refers to the enumID of one of the control’s ListItem elements.
When Edit is a descendant of a StrategyEdit element, Edit/@value refers to the wireValue of the parameter referred by Edit/@field.
</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="operator" type="lay:operator_t" use="optional">
			<xs:annotation>
				<xs:documentation>One of the following enumerated types: EX (Exists or supplied by user), NX (Does not exist or was not supplied), EQ (Equal), LT (Less than), GT (Greater than), NE (Not equal), LE (Less than equal), GE (Greater than equal). Required when logicOperator is not present. An edit element must contain either a logicOperator attribute or an operator attribute, but never both.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="logicOperator" type="lay:logicOperator_t" use="optional">
			<xs:annotation>
				<xs:documentation>Operator where operands are one or more Edit elements. Short-circuit evaluation is assumed in all edit statements. Valid values are one of the enumerations: AND, OR, XOR, NOT. Required when operator is not present. An edit element must contain either a logicOperator attribute or an operator attribute, but never both.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="id" type="xs:string" use="optional">
			<xs:annotation>
				<xs:documentation>Optional identifier. Allows for re-use of this edit within stateRule or editRef elements. This attribute is required if the Edit element is a direct child of either the Strategies or Strategy elements.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
	</xs:complexType>
	<xs:element name="EditRef" type="lay:EditRef_t"/>
	<xs:complexType name="EditRef_t">
		<xs:attribute name="id" type="xs:string" use="required">
			<xs:annotation>
				<xs:documentation>Refers to an ID of a previously defined edit element. The edit element may be defined at the strategy level or at the strategies level.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
	</xs:complexType>
	<xs:simpleType name="operator_t">
		<xs:restriction base="xs:string">
			<xs:enumeration value="EX"/>
			<xs:enumeration value="NX"/>
			<xs:enumeration value="EQ"/>
			<xs:enumeration value="NE"/>
			<xs:enumeration value="LE"/>
			<xs:enumeration value="LT"/>
			<xs:enumeration value="GE"/>
			<xs:enumeration value="GT"/>
			<!-- exists -->
			<!-- not exists -->
			<!-- equal -->
			<!-- not equal -->
			<!-- less than or equal -->
			<!-- less than -->
			<!-- greater than or equal -->
			<!-- greater than -->
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="logicOperator_t">
		<xs:restriction base="xs:string">
			<xs:enumeration value="AND"/>
			<xs:enumeration value="OR"/>
			<xs:enumeration value="XOR"/>
			<xs:enumeration value="NOT"/>
		</xs:restriction>
	</xs:simpleType>
</xs:schema>
<!-- Please email any revisions to the Steward of the Master Model & Mapping artifacts at algotech@fixprotocol.org -->
<!-- Revision History -->
<!-- Date Version Author Comments
  Authors - Greg Malatestinic, Rick Labs, Zoltan Feledy, Jim Arlet, Gideon Kaplan, Martin Naughton, Mike McDermott and other 
  members of FPL Algo Trading WG.	- if there is anyone else then please speak up :-)

30Jan08 v2.5 by Robert Golan for uris, revision history, and version stamping.
14May08 v2.4.9 by Greg Malatestinic
			- changes to <edit> to support tree-like expression structure. Added field2 attribute. logicOperator and operator 
        are mutually exclusive - one is required.
23Jan09 v2.5.6 by Martin Naughton and Mike McDermott
      - added a description element to strategyEdit and edit
      - added a reference to the Core schema to support the description element reference
16Feb09 v2.5.9 by Mike McDermott
      - added a 'val' alias to the default namespace for consistency
      - created a StrategyEdit_t complex type to conform with the existing pattern
22Feb v2.7.2 by Greg Malatestinic
	- All xsd files renamed to fixatdl-{sub-schema}-1-1.xsd. Import/@schemaLocation adjusted accordingly.
	- Namespaces changed to http://www.fixprotocol.org/FIXatdl-1-1/{sub-schema}
15Dec2010 v2.7.2e by Greg Malatestinic
	- Sync'd documentation with specification document.
-->
